import SwiftUI

/*
 * 横竖布局示例
 */
class LayoutDivExample: FCUIView{
    /*
     * 初始化布局
     */
    override func onLoad(){
        let isInit = super.m_isInit
        super.onLoad()
        if !isInit{
            m_paint.defaultUIStyle = "light"
            let width = Double(self.frame.size.width), height = Double(self.frame.size.height)
            renderFaceCat(name:"layoutdivexample", paint: m_paint, size: FCSize(cx:width, cy:height))
            let tabPage = findViewByName(name:"TabPage2", views:m_paint.views)
            let layoutDiv = FCLayoutDiv()
            layoutDiv.location = FCPoint(x:50, y:50)
            layoutDiv.size = FCSize(cx:250, cy:100)
            layoutDiv.showHScrollBar = true
            addViewToParent(view:layoutDiv, parent:tabPage)
            for _ in 0...10{
                let button = FCButton()
                button.location = FCPoint(x:0, y:0)
                button.size = FCSize(cx:100, cy:40)
                addViewToParent(view:button, parent:layoutDiv)
                button.text = "Button"
            }
            resetLayoutDiv(layout: layoutDiv)
        }
    }
}
